<%- @page_title = _('Viewing Class %s', h(@teaching.title)) -%>
<h2><%= h(@project.title) %> - <%= h(@teaching.user.name) %>
  <%- if @logged_user.is_teacher? -%>
    <span class="quick-tip"><%= link_to(_('Edit'), edit_class_path(@project, @teaching)) %></span>
  <%- end -%>
</h2>
<div class="formatted-text"><!--O .formatted-text-->
  <p><strong>Start:</strong> <%= @teaching.start.formatted %><br />
    <strong>End:</strong> <%= @teaching.end.formatted %></p>
  <%- unless @project.description.blank? -%>
    <hr />
    <%= simple_format(h(@project.description)) %>
  <%- end -%>
</div><!--C .formatted-text-->
<hr />
<p><%= link_to(_('View deadlines'), deadlines_path(@project, @teaching)) %>
  <%- if @logged_user.is_teacher? -%>
    - <%= link_to(_('Add a new deadline'), new_deadline_path(@project, @teaching)) %>
    <br />
    <%= link_to(_('View groups'), groups_path(@project, @teaching)) %>
    - <%= link_to(_('Add a new group'), new_group_path(@project, @teaching)) %>
    <br />
    <%= link_to(_('View all files uploaded for this class'), uploads_groups_path(@project, @teaching)) %>
  <%- end -%>
  <%- if @project.can_join?(@logged_user) -%>
    <br />
    <%= link_to(_('Join class'), join_class_path(@project, @teaching)) %>
  <%- else -%>
    <%- if(group = @teaching.is_member?(@logged_user)) -%>
      <br />
      <%= link_to(_("Go to your group"), group_path(@project, @teaching, group)) %>
    <%- end -%>
  <%- end -%>
</p>

<%- if @logged_user.is_teacher? -%>
  <hr />
  <%- form_tag(class_path(@project, @teaching),
                :method => :delete,
                :onsubmit => "if(confirm('#{_('Are you sure you want to delete this class?')}')){Field.disable('submit-form'); return true;}else{return false;}") do -%>
    <%= submit_tag(_('Delete this class'),
                    :class => 'button',
                    :id => 'submit-form') %>
  <%- end -%>
<%- end -%>
<hr />
<%= link_to(_("&laquo; View all classes"), classes_path(@project)) %>